package cn.bdqn.applysystem.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.bdqn.applysystem.dao.UserMapper;
import cn.bdqn.applysystem.entity.User;
import cn.bdqn.applysystem.service.UserService;

@Service("userServiceImpl")
public class UserServiceImpl implements UserService {


	@Autowired
	@Qualifier("userMapper")
	UserMapper userMapper;
	
	/**
	 * 登录
	 * */
	@Override
	@Transactional(propagation=Propagation.SUPPORTS,isolation=Isolation.READ_COMMITTED)
	public User login(String userName, String password) {
		User user = userMapper.selectUserByUserNameAndPassword(userName, password);
		return user;
	}

	@Override
	@Transactional(propagation=Propagation.SUPPORTS,isolation=Isolation.READ_COMMITTED)
	public Integer findUserByGradeId(Integer gradeId) {
		return userMapper.selectUserByGradeId(gradeId);
	}

}
